import { Component, Input, OnInit, Renderer2 } from '@angular/core';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';

@Component({
  selector: 'apes-iframe',
  template: `
<!--    <button type="submit" class="btn btn-default" (click)=updateSrc(url)>test</button>-->
    <iframe id="leftPaneIframe" name="leftPaneIframe" [src]="currentURL" width="100%" height="100%"
            frameborder=0></iframe>
  `,
})
export class ApesIframeComponent implements OnInit {
  @Input() url: any;
  currentURL: SafeUrl;

  ngOnInit(): void {
    this.currentURL = this.sanitizer.bypassSecurityTrustResourceUrl(this.url);
  }

  constructor(private sanitizer: DomSanitizer,private renderer: Renderer2) {

  }

  loadLeftURL(leftPaneURLValue) {
    console.log(leftPaneURLValue);
  }

  updateSrc(url) {
    // let url ="http://10.2.0.58:6072/ureport/designer?_u=oracle:oracle:kmyeb.ureport.xml###";
    this.currentURL = this.sanitizer.bypassSecurityTrustResourceUrl(url);
  }

}
